<?php /* Smarty version Smarty-3.1.18, created on 2017-07-22 21:16:23
         compiled from "/Applications/MAMP/htdocs/PHP/jifenshop/protected/template/wap/address.list_address.html" */ ?>
<?php /*%%SmartyHeaderCode:1531972655973502728ed11-34230449%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '4d9c2e814a1b8a4e7b82539538761c5c5a2abf87' => 
    array (
      0 => '/Applications/MAMP/htdocs/PHP/jifenshop/protected/template/wap/address.list_address.html',
      1 => 1465890885,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '1531972655973502728ed11-34230449',
  'function' => 
  array (
  ),
  'variables' => 
  array (
    'data' => 0,
    'g' => 0,
  ),
  'has_nocache_code' => false,
  'version' => 'Smarty-3.1.18',
  'unifunc' => 'content_59735027317a85_59457700',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_59735027317a85_59457700')) {function content_59735027317a85_59457700($_smarty_tpl) {?><?php echo $_smarty_tpl->getSubTemplate ("header.html", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?>

<body class="gr">

<div class="navBar">
	<a class="left" href="javascript:history.back()"><i class="return"></i></a>
	<div class="titleView">收货地址管理</div>
	<a class="right" href="wap.php?tpl=address.add_address">添加</a>
</div>

<div class="address-list main-padding-top">
	<div class="pullRefresh">
		<section>
			<?php  $_smarty_tpl->tpl_vars['g'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['g']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['data']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['g']->key => $_smarty_tpl->tpl_vars['g']->value) {
$_smarty_tpl->tpl_vars['g']->_loop = true;
?>
			<ul class="list tableView tableView-noLine">
				<li>
					<h1>
						<div class="name"><?php echo $_smarty_tpl->tpl_vars['g']->value->contactman;?>
　<?php echo $_smarty_tpl->tpl_vars['g']->value->mobile;?>
</div>
						<div class="address"><?php echo $_smarty_tpl->tpl_vars['g']->value->province;?>
<?php if ($_smarty_tpl->tpl_vars['g']->value->province!=$_smarty_tpl->tpl_vars['g']->value->city) {?> <?php echo $_smarty_tpl->tpl_vars['g']->value->city;?>
<?php }?> <?php echo $_smarty_tpl->tpl_vars['g']->value->district;?>
 <?php echo $_smarty_tpl->tpl_vars['g']->value->address;?>
</div>
					</h1>
					<div class="ge-bottom ge-light"></div>
					<div class="bottomView">
						<form method="post" action="api.php?app=address&act=delete_address">
						<input type="hidden" name="gourl" value="wap.php?app=address&&act=list_address" />
						<input type="hidden" name="id" value="<?php echo $_smarty_tpl->tpl_vars['g']->value->id;?>
" />
						<a href="javascript:void(0)" class="btn delete"><span>删除</span></a>
						</form>
						<a href="wap.php?app=address&act=get_address&id=<?php echo $_smarty_tpl->tpl_vars['g']->value->id;?>
" class="btn edit"><span>编辑</span></a>
						<form method="post" action="api.php?app=address&act=set_default">
						<input type="hidden" name="gourl" value="wap.php?app=address&&act=list_address" />
						<input type="hidden" name="id" value="<?php echo $_smarty_tpl->tpl_vars['g']->value->id;?>
" />
						<a href="javascript:void(0)" class="default">设为默认地址</a>
						</form>
					</div>
				</li>
			</ul>
			<?php } ?>
		</section>
	</div>
</div>

<?php echo $_smarty_tpl->getSubTemplate ("footer.html", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?>

<script>
var offset = $('.pullRefresh .list > li').length;
function createHtml(g){
	var html = '<li>\
		<h1>\
			<div class="name">'+g.contactman+'　'+g.mobile+'</div>\
			<div class="address">'+(g.province+(g.province!=g.city?' '+g.city:'')+' '+g.district+' '+g.address)+'</div>\
		</h1>\
		<div class="ge-bottom ge-light"></div>\
		<div class="bottomView">\
			<form method="post" action="api.php?app=address&act=delete_address">\
			<input type="hidden" name="gourl" value="wap.php?app=address&&act=list_address" />\
			<input type="hidden" name="id" value="'+g.id+'" />\
			<a href="javascript:void(0)" class="btn delete"><span>删除</span></a>\
			</form>\
			<a href="wap.php?app=address&act=edit_address&id='+g.id+'" class="btn edit"><span>编辑</span></a>\
			<form method="post" action="api.php?app=address&act=set_default">\
			<input type="hidden" name="gourl" value="wap.php?app=address&&act=list_address" />\
			<input type="hidden" name="id" value="'+g.id+'" />\
			<a href="javascript:void(0)" class="default">设为默认地址</a>\
			</form>\
		</div>\
	</li>';
	offset++;
	return html;
}
$(function(){
	$('.address-list').height($.window().height-$('.address-list').padding().top);
	$('.pullRefresh').pullRefresh({
		header : true,
		footer : true,
		footerNoMoreText : '- END -',
		refresh : function(fn){
			var _this = this;
			offset = 0;
			$.getJSON('api.php?app=address&act=list_address', function(json){
				if(json.error!=0){ $.overloadError(json.msg);return; }
				var html = '';
				if($.isArray(json.data))for(var i=0; i<json.data.length; i++)html += createHtml(json.data[i]);
				_this.find('.list').html(html);
				fn();
			});
		},
		load : function(fn){
			var _this = this;
			$.getJSON('api.php?app=address&act=list_address', { offset:offset }, function(json){
				if(json.error!=0){ $.overloadError(json.msg);return; }
				var html = '';
				if($.isArray(json.data))for(var i=0; i<json.data.length; i++)html += createHtml(json.data[i]);
				_this.find('.list').append(html);
				fn();
			});
		}
	});
	$(document).on('click', '.delete', function(){
		$(this).parent().submit();
	});
	$(document).on('click', '.default', function(){
		$(this).parent().submit();
	});
});
</script><?php }} ?>
